package behavioral_pattern.observer_pattern;

public class Player implements Observer {
    public Player(String name) {
        this.name = name;
    }

    protected String name;
    @Override
    public void setName(String name) {
       this.name = name;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void help() {
        System.out.println("坚持住,"+this.name+"来救你!");
    }

    @Override
    public void beAttacked(AllyControlCenter acc) {
        System.out.println(this.name+"正在被攻击!");
        acc.notifyObserver(name);
    }
}
